function add(x, y, z) {
  return x + y + z;
}

console.log(add(10, 20, 30));

function sum1(x) {
  return function (y) {
    return function (z) {
      return x + y + z;
    };
  };
}
console.log(sum1(10)(20)(30));

// 简化柯里化的代码
var sum2 = (x) => (y) => (z) => {
  return x + y + z;
};
console.log(sum2(10)(20)(30));

var num3 = (x) => (y) => (z) => x + y + z;
console.log(num3(10)(20)(30));
